/*
package io.renren.modules.order.task;

import io.renren.modules.job.task.ITask;
import io.renren.modules.order.WebSoket.WebSocketServer;
import io.renren.modules.order.enity.MerchantOrderEntityVo;
import io.renren.modules.order.service.MerchantOrderService;
import io.renren.modules.sys.entity.SysUserEntity;
import io.renren.modules.sys.service.SysUserService;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@Component("testTask2")
public class testTask2 implements ITask {
    @Resource
    private SysUserService sysUserService;
    @Resource
    private WebSocketServer webSocket;
    @Resource
    private MerchantOrderService merchantOrderService;
    @Override
    public void run(String params) {
        JSONObject jsonObject = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        merchantOrderService.getMerchantOrder(webSocket.id).forEach(item -> {
                    String orderCode = item.getOrderCode();
                    String receiver = item.getReceiver();
                    String receiverPhone = item.getReceiverPhone();
                    String address = item.getAddress();
                    String fullAddress = item.getFullAddress();
                    jsonObject.put("orderCode", orderCode);
                    jsonObject.put("receiver", receiver);
                    jsonObject.put("receiverPhone", receiverPhone);
                    jsonObject.put("address", address);
                    jsonObject.put("fullAddress", fullAddress);
                    jsonArray.put(jsonObject);
                }
        );
        try {
            webSocket.sendMessage(jsonArray.toString());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
*/
